import {
  ProForm,
  ProFormDatePicker,
  ProFormSelect,
  ProFormText,
  ProFormTextArea,
} from "@ant-design/pro-components";
import { message } from "antd";

import React from "react";

const FormPage: React.FC = () => {
  const handleSubmit = async (values: any) => {
    console.log("表单数据:", values);
    message.success("提交成功！");
  };

  return (
    <div style={{ padding: 24 }}>
      <h1>用户信息表单</h1>
      <ProForm
        onFinish={handleSubmit}
        layout="vertical"
        style={{ maxWidth: 600 }}
      >
        <ProFormText
          name="name"
          label="姓名"
          placeholder="请输入姓名"
          rules={[{ required: true, message: "请输入姓名" }]}
        />
        <ProFormText
          name="email"
          label="邮箱"
          placeholder="请输入邮箱"
          rules={[
            { required: true, message: "请输入邮箱" },
            { type: "email", message: "请输入有效的邮箱地址" },
          ]}
        />
        <ProFormSelect
          name="gender"
          label="性别"
          options={[
            { label: "男", value: "male" },
            { label: "女", value: "female" },
          ]}
          placeholder="请选择性别"
        />
        <ProFormDatePicker
          name="birthday"
          label="生日"
          placeholder="请选择生日"
        />
        <ProFormTextArea
          name="description"
          label="个人简介"
          placeholder="请输入个人简介"
          rows={4}
        />
      </ProForm>
    </div>
  );
};

export default FormPage;
